package cn.fancy.sdk.utils;

import android.content.Context;
import java.util.Objects;

/**
 * Created by zhaojh on date 2023/8/25
 */
public class MoneyDiscountHelper {
    
    public static boolean needDiscount(Context context) {
        return SpMmkvUtils.getValue(context, SpMmkvUtils.KEY_DISCOUNT) != null
            && (!Objects.equals(SpMmkvUtils.getValue(context, SpMmkvUtils.KEY_DISCOUNT), "0"));
    }
    
    public static float calculateMoneyAfterDiscount(Context context, float money) {
        return money * Float.parseFloat(SpMmkvUtils.getValue(context, SpMmkvUtils.KEY_DISCOUNT)) / 10;
    }
}
